Dynomotion

Group: DynoMotion Message: 5205 From: himykabibble Date: 6/13/2012
Subject: RS232 Not Working?
Tom,

I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?

Does the EnableRS232Cmds call set the pin directions, or do I need to do that?

Regards,
Ray L.
Group: DynoMotion Message: 5206 From: himykabibble Date: 6/13/2012
Subject: Re: RS232 Not Working?
FWIW - I tried the poll-driven code from the RS232 web page, and got exactly the same result....

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@...> wrote:
>
> Tom,
>
> I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?
>
> Does the EnableRS232Cmds call set the pin directions, or do I need to do that?
>
> Regards,
> Ray L.
>
Group: DynoMotion Message: 5207 From: Tom Kerekes Date: 6/14/2012
Subject: Re: RS232 Not Working?
Hi Ray,

You cannot leave the LVTTL UART input floating and expect a predicable result.

You might connect the input to the output as a loopback for testing.

You can check on the Digital IO screen how the IO is configured.

Regards
TK

Group: DynoMotion Message: 5208 From: himykabibble Date: 6/14/2012
Subject: Re: RS232 Not Working?
Tom,

Why are the inputs so sensitive? I've noticed many times that if I change one input while watching the Digital I/O dialog, it is not unusual to see several inputs flash briefly to a different state. I thought most of the inputs had pull-downs on them?

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>
> You cannot leave the LVTTL UART input floating and expect a predicable result.
> You might connect the input to the output as a loopback for testing.
>
> You can check on the Digital IO screen how the IO is configured.
>
> Regards
> TK
>
>
>
> ________________________________
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, June 13, 2012 11:56 PM
> Subject: [DynoMotion] Re: RS232 Not Working?
>
>
>  
> FWIW - I tried the poll-driven code from the RS232 web page, and got exactly the same result....
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> >
> > Tom,
> >
> > I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?
> >
> > Does the EnableRS232Cmds call set the pin directions, or do I need to do that?
> >
> > Regards,
> > Ray L.
> >
>
Group: DynoMotion Message: 5209 From: Tom Kerekes Date: 6/14/2012
Subject: Re: RS232 Not Working?
Hi Ray,

Most of the IO do not have pull down resistors.  Pull down resistors would interfere with the open-collector output mode.  There are 16 IO with strong 150ohm pull downs. The first 8 on JP4 and JP6.  The Inputs are MosFETS which are very high impedance (multi-meg ohms).  To be used as an input they must be driven high and low by something.  If left undriven they will float to any level and can be influenced by the slightest signal such as the parasitic capacitance to a nearby signal.

Regards
TK

Group: DynoMotion Message: 5210 From: himykabibble Date: 6/14/2012
Subject: Re: RS232 Not Working?
Tom,

Still no dice. I hard-wired JP7-5 to JP7-6. No other I/Os have anything connected. I run the following program, and it prints the correct values for the sent data, and always zero for the received data. I'm stuck....

Regards,
Ray L.

#include "KMotionDef.h"

void ReceiveChar()
{
// wait for data in buffer
while ((FPGA(RS232_STATUS) & RS232_DATA_READY)==0)
;
return FPGA(RS232_DATA);
}

void SendChar(char c)
{
while (FPGA(RS232_STATUS) & RS232_TRANSMIT_FULL)
;
FPGA(RS232_DATA) = c;
}


main()
{
int i;
char c = 'A';

SetBitDirection(44,0);
SetBitDirection(45,1);
FPGA(RS232_BAUD_REG) = RS232_BAUD_9600;
for (i=0; i<4; i++)
{
SendChar(c);
printf("Sent: %c\n", c++);
printf("Received %x\n", ReceiveChar());
}
}

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>
> Most of the IO do not have pull down resistors.  Pull down resistors would interfere with the open-collector output mode.  There are 16 IO with strong 150ohm pull downs. The first 8 on JP4 and JP6.  The Inputs are MosFETS which are very high impedance (multi-meg ohms).  To be used as an input they must be driven high and low by something.  If left undriven they will float to any level and can be influenced by the slightest signal such as the parasitic capacitance to a nearby signal.
>
> Regards
> TK
>
>
>
> ________________________________
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 14, 2012 8:02 AM
> Subject: [DynoMotion] Re: RS232 Not Working?
>
>
>  
> Tom,
>
> Why are the inputs so sensitive? I've noticed many times that if I change one input while watching the Digital I/O dialog, it is not unusual to see several inputs flash briefly to a different state. I thought most of the inputs had pull-downs on them?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Ray,
> >
> > You cannot leave the LVTTL UART input floating and expect a predicable result.
> > You might connect the input to the output as a loopback for testing.
> >
> > You can check on the Digital IO screen how the IO is configured.
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: himykabibble <jagboy@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Wednesday, June 13, 2012 11:56 PM
> > Subject: [DynoMotion] Re: RS232 Not Working?
> >
> >
> >  
> > FWIW - I tried the poll-driven code from the RS232 web page, and got exactly the same result....
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> > >
> > > Tom,
> > >
> > > I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?
> > >
> > > Does the EnableRS232Cmds call set the pin directions, or do I need to do that?
> > >
> > > Regards,
> > > Ray L.
> > >
> >
>
Group: DynoMotion Message: 5213 From: Tom Kerekes Date: 6/14/2012
Subject: Re: RS232 Not Working?
Hi Ray,
 
I think the RS232 needs to be enabled with:
 
FPGA(KAN_TRIG_REG) = 2;
// enable RS232 working (if Kanalog, it will be changed to 3)
 
It would be better if you used the newer buffered functions which do the buffering for you, enable this for you, and allow higher baud rates.
 
Regards
TK. 

Group: DynoMotion Message: 5220 From: himykabibble Date: 6/14/2012
Subject: Re: RS232 Not Working?
Tom,

See below....

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> I think the RS232 needs to be enabled with:
>  FPGA(KAN_TRIG_REG) = 2;

Wouldn't that be a useful detail to include in the example code? No offense, but this is one of the things that has made KFlop very frustrating at times to work with - the example code often simply does not work as written, and/or contains extraneous instructions that have nothing to do with the function that is the heart of the example, and/or misleading comments.

> It would be better if you used the newer buffered functions which do > the buffering for you, enable this for you, and allow higher baud > > rates.

Well, that's exactly where I started, but that didn't work either, no doubt for the same reason.


>  
>  
> Regards
> TK. 
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 14, 2012 12:23 PM
> Subject: [DynoMotion] Re: RS232 Not Working?
>
>
>  
> Tom,
>
> Still no dice. I hard-wired JP7-5 to JP7-6. No other I/Os have anything connected. I run the following program, and it prints the correct values for the sent data, and always zero for the received data. I'm stuck....
>
> Regards,
> Ray L.
>
> #include "KMotionDef.h"
>
> void ReceiveChar()
> {
> // wait for data in buffer
> while ((FPGA(RS232_STATUS) & RS232_DATA_READY)==0)
> ;
> return FPGA(RS232_DATA);
> }
>
> void SendChar(char c)
> {
> while (FPGA(RS232_STATUS) & RS232_TRANSMIT_FULL)
> ;
> FPGA(RS232_DATA) = c;
> }
>
> main()
> {
> int i;
> char c = 'A';
>
> SetBitDirection(44,0);
> SetBitDirection(45,1);
> FPGA(RS232_BAUD_REG) = RS232_BAUD_9600;
> for (i=0; i<4; i++)
> {
> SendChar(c);
> printf("Sent: %c\n", c++);
> printf("Received %x\n", ReceiveChar());
> }
> }
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Ray,
> >
> > Most of the IO do not have pull down resistors.  Pull down resistors would interfere with the open-collector output mode.  There are 16 IO with strong 150ohm pull downs. The first 8 on JP4 and JP6.  The Inputs are MosFETS which are very high impedance (multi-meg ohms).  To be used as an input they must be driven high and low by something.  If left undriven they will float to any level and can be influenced by the slightest signal such as the parasitic capacitance to a nearby signal.
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: himykabibble <jagboy@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, June 14, 2012 8:02 AM
> > Subject: [DynoMotion] Re: RS232 Not Working?
> >
> >
> >  
> > Tom,
> >
> > Why are the inputs so sensitive? I've noticed many times that if I change one input while watching the Digital I/O dialog, it is not unusual to see several inputs flash briefly to a different state. I thought most of the inputs had pull-downs on them?
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Ray,
> > >
> > > You cannot leave the LVTTL UART input floating and expect a predicable result.
> > > You might connect the input to the output as a loopback for testing.
> > >
> > > You can check on the Digital IO screen how the IO is configured.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: himykabibble <jagboy@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Wednesday, June 13, 2012 11:56 PM
> > > Subject: [DynoMotion] Re: RS232 Not Working?
> > >
> > >
> > >  
> > > FWIW - I tried the poll-driven code from the RS232 web page, and got exactly the same result....
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> > > >
> > > > Tom,
> > > >
> > > > I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?
> > > >
> > > > Does the EnableRS232Cmds call set the pin directions, or do I need to do that?
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > >
> >
>
>
>
>
> // enable RS232 working (if Kanalog, it will be changed to 3)It would be better if you used the newer buffered functions which do the buffering for you, enable this for you, and allow higher baud rates.
>
Group: DynoMotion Message: 5221 From: Tom Kerekes Date: 6/14/2012
Subject: Re: RS232 Not Working?
Hi Ray,
 
I thought when you were trying the recommended buffered example your input was floating?  The new FPGA setting is automatically handled in the buffered routines that should not have been the problem.
 
Regards
TK

Group: DynoMotion Message: 5222 From: himykabibble Date: 6/14/2012
Subject: Re: RS232 Not Working?
Tom,

Nope, I tried it in loopback as well.

BTW - What signal polarity is the UART expecting? Should a received start bit be a rising or falling edge? I assume Tx is the same? I believe RS232 transceivers are inverting, no?

I have loopback working on both the pendant and the KFlop, but they won't talk to each other when connected together.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> I thought when you were trying the recommended buffered example your input was floating?  The new FPGA setting is automatically handled in the buffered routines that should not have been the problem.
>  
> Regards
> TK
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 14, 2012 5:31 PM
> Subject: [DynoMotion] Re: RS232 Not Working?
>
>
>  
> Tom,
>
> See below....
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Ray,
> >  
> > I think the RS232 needs to be enabled with:
> >  FPGA(KAN_TRIG_REG) = 2;
>
> Wouldn't that be a useful detail to include in the example code? No offense, but this is one of the things that has made KFlop very frustrating at times to work with - the example code often simply does not work as written, and/or contains extraneous instructions that have nothing to do with the function that is the heart of the example, and/or misleading comments.
>
> > It would be better if you used the newer buffered functions which do > the buffering for you, enable this for you, and allow higher baud > > rates.
>
> Well, that's exactly where I started, but that didn't work either, no doubt for the same reason.
>
> >  
> >  
> > Regards
> > TK. 
> >
> > From: himykabibble <jagboy@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, June 14, 2012 12:23 PM
> > Subject: [DynoMotion] Re: RS232 Not Working?
> >
> >
> >  
> > Tom,
> >
> > Still no dice. I hard-wired JP7-5 to JP7-6. No other I/Os have anything connected. I run the following program, and it prints the correct values for the sent data, and always zero for the received data. I'm stuck....
> >
> > Regards,
> > Ray L.
> >
> > #include "KMotionDef.h"
> >
> > void ReceiveChar()
> > {
> > // wait for data in buffer
> > while ((FPGA(RS232_STATUS) & RS232_DATA_READY)==0)
> > ;
> > return FPGA(RS232_DATA);
> > }
> >
> > void SendChar(char c)
> > {
> > while (FPGA(RS232_STATUS) & RS232_TRANSMIT_FULL)
> > ;
> > FPGA(RS232_DATA) = c;
> > }
> >
> > main()
> > {
> > int i;
> > char c = 'A';
> >
> > SetBitDirection(44,0);
> > SetBitDirection(45,1);
> > FPGA(RS232_BAUD_REG) = RS232_BAUD_9600;
> > for (i=0; i<4; i++)
> > {
> > SendChar(c);
> > printf("Sent: %c\n", c++);
> > printf("Received %x\n", ReceiveChar());
> > }
> > }
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Ray,
> > >
> > > Most of the IO do not have pull down resistors.  Pull down resistors would interfere with the open-collector output mode.  There are 16 IO with strong 150ohm pull downs. The first 8 on JP4 and JP6.  The Inputs are MosFETS which are very high impedance (multi-meg ohms).  To be used as an input they must be driven high and low by something.  If left undriven they will float to any level and can be influenced by the slightest signal such as the parasitic capacitance to a nearby signal.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: himykabibble <jagboy@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Thursday, June 14, 2012 8:02 AM
> > > Subject: [DynoMotion] Re: RS232 Not Working?
> > >
> > >
> > >  
> > > Tom,
> > >
> > > Why are the inputs so sensitive? I've noticed many times that if I change one input while watching the Digital I/O dialog, it is not unusual to see several inputs flash briefly to a different state. I thought most of the inputs had pull-downs on them?
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Ray,
> > > >
> > > > You cannot leave the LVTTL UART input floating and expect a predicable result.
> > > > You might connect the input to the output as a loopback for testing.
> > > >
> > > > You can check on the Digital IO screen how the IO is configured.
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: himykabibble <jagboy@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Wednesday, June 13, 2012 11:56 PM
> > > > Subject: [DynoMotion] Re: RS232 Not Working?
> > > >
> > > >
> > > > ÃÆ'‚ 
> > > > FWIW - I tried the poll-driven code from the RS232 web page, and got exactly the same result....
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> > > > >
> > > > > Tom,
> > > > >
> > > > > I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?
> > > > >
> > > > > Does the EnableRS232Cmds call set the pin directions, or do I need to do that?
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > >
> > >
> >
> >
> >
> >
> > // enable RS232 working (if Kanalog, it will be changed to 3)It would be better if you used the newer buffered functions which do the buffering for you, enable this for you, and allow higher baud rates.
> >
>
Group: DynoMotion Message: 5223 From: Tom Kerekes Date: 6/14/2012
Subject: Re: RS232 Not Working?
Hi Ray,
 
I believe RS232 tranceivers are inverting.  The simplest thing to do if you have loopback working would be to look at the digital IO screen when not transmitting and observe the level.  Yes Transmit and Receive are the same polarity otherwise loopback wouldn't work.
 
So you tried it in loopback mode and it didn't work, but now it works??
 
Regards
TK
 
 

Group: DynoMotion Message: 5224 From: himykabibble Date: 6/15/2012
Subject: Re: RS232 Not Working?
Tom,

I've got the two boards talking now. However, the "buffered" I/O example contains only read and write functions, which are both blocking functions. Is there no non-blocking function to determine IF there is a character waiting? If not, there really needs to be, to make it usable.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> I believe RS232 tranceivers are inverting.  The simplest thing to do if you have loopback working would be to look at the digital IO screen when not transmitting and observe the level.  Yes Transmit and Receive are the same polarity otherwise loopback wouldn't work.
>  
> So you tried it in loopback mode and it didn't work, but now it works??
>  
> Regards
> TK
>  
>  
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 14, 2012 6:41 PM
> Subject: [DynoMotion] Re: RS232 Not Working?
>
>
>  
> Tom,
>
> Nope, I tried it in loopback as well.
>
> BTW - What signal polarity is the UART expecting? Should a received start bit be a rising or falling edge? I assume Tx is the same? I believe RS232 transceivers are inverting, no?
>
> I have loopback working on both the pendant and the KFlop, but they won't talk to each other when connected together.
>
> Regards,
> Ray L.
>
> --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Ray,
> >  
> > I thought when you were trying the recommended buffered example your input was floating?  The new FPGA setting is automatically handled in the buffered routines that should not have been the problem.
> >  
> > Regards
> > TK
> >
> > From: himykabibble <jagboy@>
> > To: mailto:DynoMotion%40yahoogroups.com
> > Sent: Thursday, June 14, 2012 5:31 PM
> > Subject: [DynoMotion] Re: RS232 Not Working?
> >
> >
> >  
> > Tom,
> >
> > See below....
> >
> > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Ray,
> > >  
> > > I think the RS232 needs to be enabled with:
> > >  FPGA(KAN_TRIG_REG) = 2;
> >
> > Wouldn't that be a useful detail to include in the example code? No offense, but this is one of the things that has made KFlop very frustrating at times to work with - the example code often simply does not work as written, and/or contains extraneous instructions that have nothing to do with the function that is the heart of the example, and/or misleading comments.
> >
> > > It would be better if you used the newer buffered functions which do > the buffering for you, enable this for you, and allow higher baud > > rates.
> >
> > Well, that's exactly where I started, but that didn't work either, no doubt for the same reason.
> >
> > >  
> > >  
> > > Regards
> > > TK. 
> > >
> > > From: himykabibble <jagboy@>
> > > To: mailto:DynoMotion%40yahoogroups.com
> > > Sent: Thursday, June 14, 2012 12:23 PM
> > > Subject: [DynoMotion] Re: RS232 Not Working?
> > >
> > >
> > >  
> > > Tom,
> > >
> > > Still no dice. I hard-wired JP7-5 to JP7-6. No other I/Os have anything connected. I run the following program, and it prints the correct values for the sent data, and always zero for the received data. I'm stuck....
> > >
> > > Regards,
> > > Ray L.
> > >
> > > #include "KMotionDef.h"
> > >
> > > void ReceiveChar()
> > > {
> > > // wait for data in buffer
> > > while ((FPGA(RS232_STATUS) & RS232_DATA_READY)==0)
> > > ;
> > > return FPGA(RS232_DATA);
> > > }
> > >
> > > void SendChar(char c)
> > > {
> > > while (FPGA(RS232_STATUS) & RS232_TRANSMIT_FULL)
> > > ;
> > > FPGA(RS232_DATA) = c;
> > > }
> > >
> > > main()
> > > {
> > > int i;
> > > char c = 'A';
> > >
> > > SetBitDirection(44,0);
> > > SetBitDirection(45,1);
> > > FPGA(RS232_BAUD_REG) = RS232_BAUD_9600;
> > > for (i=0; i<4; i++)
> > > {
> > > SendChar(c);
> > > printf("Sent: %c\n", c++);
> > > printf("Received %x\n", ReceiveChar());
> > > }
> > > }
> > >
> > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Ray,
> > > >
> > > > Most of the IO do not have pull down resistors.ÃÆ'‚  Pull down resistors would interfere with the open-collector output mode.ÃÆ'‚  There are 16 IO with strong 150ohm pull downs. The first 8 on JP4 and JP6.ÃÆ'‚  The Inputs are MosFETS which are very high impedance (multi-meg ohms).ÃÆ'‚  To be used as an input they must be driven high and low by something.ÃÆ'‚  If left undriven they will float to any level and can be influenced by the slightest signal such as the parasitic capacitance to a nearby signal.
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: himykabibble <jagboy@>
> > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > Sent: Thursday, June 14, 2012 8:02 AM
> > > > Subject: [DynoMotion] Re: RS232 Not Working?
> > > >
> > > >
> > > > ÃÆ'‚ 
> > > > Tom,
> > > >
> > > > Why are the inputs so sensitive? I've noticed many times that if I change one input while watching the Digital I/O dialog, it is not unusual to see several inputs flash briefly to a different state. I thought most of the inputs had pull-downs on them?
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > >
> > > > > Hi Ray,
> > > > >
> > > > > You cannot leave the LVTTL UART input floating and expect a predicable result.
> > > > > You might connect the input to the output as a loopback for testing.
> > > > >
> > > > > You can check on the Digital IO screen how the IO is configured.
> > > > >
> > > > > Regards
> > > > > TK
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: himykabibble <jagboy@>
> > > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > > Sent: Wednesday, June 13, 2012 11:56 PM
> > > > > Subject: [DynoMotion] Re: RS232 Not Working?
> > > > >
> > > > >
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > FWIW - I tried the poll-driven code from the RS232 web page, and got exactly the same result....
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > > > --- In mailto:DynoMotion%40yahoogroups.com, "himykabibble" <jagboy@> wrote:
> > > > > >
> > > > > > Tom,
> > > > > >
> > > > > > I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?
> > > > > >
> > > > > > Does the EnableRS232Cmds call set the pin directions, or do I need to do that?
> > > > > >
> > > > > > Regards,
> > > > > > Ray L.
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > >
> > > // enable RS232 working (if Kanalog, it will be changed to 3)It would be better if you used the newer buffered functions which do the buffering for you, enable this for you, and allow higher baud rates.
> > >
> >
>
Group: DynoMotion Message: 5226 From: Tom Kerekes Date: 6/15/2012
Subject: Re: RS232 Not Working?
Hi Ray,
 
Great.  The Buffered example shows how this line can be used to check if there is data in the Receive Buffer.
 
 while (pRS232RecIn == pRS232RecOut); // wait for data in buffer
Regards
TK
 
 
Group: DynoMotion Message: 5229 From: himykabibble Date: 6/15/2012
Subject: Re: RS232 Not Working?
Tom,

I dunno how I missed that.... Is there any reason I can't, or shouldn't, flush the buffer by simply setting the two pointers to the same value?

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> Great.  The Buffered example shows how this line can be used to check if there is data in the Receive Buffer.
>  
>  while (pRS232RecIn == pRS232RecOut); // wait for data in buffer
>
> Regards
> TK
>  
>  
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, June 15, 2012 3:52 PM
> Subject: [DynoMotion] Re: RS232 Not Working?
>
>
>  
> Tom,
>
> I've got the two boards talking now. However, the "buffered" I/O example contains only read and write functions, which are both blocking functions. Is there no non-blocking function to determine IF there is a character waiting? If not, there really needs to be, to make it usable.
>
> Regards,
> Ray L.
>
> --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Ray,
> >  
> > I believe RS232 tranceivers are inverting.  The simplest thing to do if you have loopback working would be to look at the digital IO screen when not transmitting and observe the level.  Yes Transmit and Receive are the same polarity otherwise loopback wouldn't work.
> >  
> > So you tried it in loopback mode and it didn't work, but now it works??
> >  
> > Regards
> > TK
> >  
> >  
> >
> > From: himykabibble <jagboy@>
> > To: mailto:DynoMotion%40yahoogroups.com
> > Sent: Thursday, June 14, 2012 6:41 PM
> > Subject: [DynoMotion] Re: RS232 Not Working?
> >
> >
> >  
> > Tom,
> >
> > Nope, I tried it in loopback as well.
> >
> > BTW - What signal polarity is the UART expecting? Should a received start bit be a rising or falling edge? I assume Tx is the same? I believe RS232 transceivers are inverting, no?
> >
> > I have loopback working on both the pendant and the KFlop, but they won't talk to each other when connected together.
> >
> > Regards,
> > Ray L.
> >
> > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Ray,
> > >  
> > > I thought when you were trying the recommended buffered example your input was floating?  The new FPGA setting is automatically handled in the buffered routines that should not have been the problem.
> > >  
> > > Regards
> > > TK
> > >
> > > From: himykabibble <jagboy@>
> > > To: mailto:DynoMotion%40yahoogroups.com
> > > Sent: Thursday, June 14, 2012 5:31 PM
> > > Subject: [DynoMotion] Re: RS232 Not Working?
> > >
> > >
> > >  
> > > Tom,
> > >
> > > See below....
> > >
> > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Ray,
> > > > ÃÆ'‚ 
> > > > I think the RS232 needs to be enabled with:
> > > > ÃÆ'‚ FPGA(KAN_TRIG_REG) = 2;
> > >
> > > Wouldn't that be a useful detail to include in the example code? No offense, but this is one of the things that has made KFlop very frustrating at times to work with - the example code often simply does not work as written, and/or contains extraneous instructions that have nothing to do with the function that is the heart of the example, and/or misleading comments.
> > >
> > > > It would be better if you used the newer buffered functions which do > the buffering for you, enable this for you, and allow higher baud > > rates.
> > >
> > > Well, that's exactly where I started, but that didn't work either, no doubt for the same reason.
> > >
> > > > ÃÆ'‚ 
> > > > ÃÆ'‚ 
> > > > Regards
> > > > TK.ÃÆ'‚ 
> > > >
> > > > From: himykabibble <jagboy@>
> > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > Sent: Thursday, June 14, 2012 12:23 PM
> > > > Subject: [DynoMotion] Re: RS232 Not Working?
> > > >
> > > >
> > > > ÃÆ'‚ 
> > > > Tom,
> > > >
> > > > Still no dice. I hard-wired JP7-5 to JP7-6. No other I/Os have anything connected. I run the following program, and it prints the correct values for the sent data, and always zero for the received data. I'm stuck....
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > #include "KMotionDef.h"
> > > >
> > > > void ReceiveChar()
> > > > {
> > > > // wait for data in buffer
> > > > while ((FPGA(RS232_STATUS) & RS232_DATA_READY)==0)
> > > > ;
> > > > return FPGA(RS232_DATA);
> > > > }
> > > >
> > > > void SendChar(char c)
> > > > {
> > > > while (FPGA(RS232_STATUS) & RS232_TRANSMIT_FULL)
> > > > ;
> > > > FPGA(RS232_DATA) = c;
> > > > }
> > > >
> > > > main()
> > > > {
> > > > int i;
> > > > char c = 'A';
> > > >
> > > > SetBitDirection(44,0);
> > > > SetBitDirection(45,1);
> > > > FPGA(RS232_BAUD_REG) = RS232_BAUD_9600;
> > > > for (i=0; i<4; i++)
> > > > {
> > > > SendChar(c);
> > > > printf("Sent: %c\n", c++);
> > > > printf("Received %x\n", ReceiveChar());
> > > > }
> > > > }
> > > >
> > > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > >
> > > > > Hi Ray,
> > > > >
> > > > > Most of the IO do not have pull down resistors.ÃÆ'Æ'‚ÃÆ'‚  Pull down resistors would interfere with the open-collector output mode.ÃÆ'Æ'‚ÃÆ'‚  There are 16 IO with strong 150ohm pull downs. The first 8 on JP4 and JP6.ÃÆ'Æ'‚ÃÆ'‚  The Inputs are MosFETS which are very high impedance (multi-meg ohms).ÃÆ'Æ'‚ÃÆ'‚  To be used as an input they must be driven high and low by something.ÃÆ'Æ'‚ÃÆ'‚  If left undriven they will float to any level and can be influenced by the slightest signal such as the parasitic capacitance to a nearby signal.
> > > > >
> > > > > Regards
> > > > > TK
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: himykabibble <jagboy@>
> > > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > > Sent: Thursday, June 14, 2012 8:02 AM
> > > > > Subject: [DynoMotion] Re: RS232 Not Working?
> > > > >
> > > > >
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > Tom,
> > > > >
> > > > > Why are the inputs so sensitive? I've noticed many times that if I change one input while watching the Digital I/O dialog, it is not unusual to see several inputs flash briefly to a different state. I thought most of the inputs had pull-downs on them?
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > > >
> > > > > > Hi Ray,
> > > > > >
> > > > > > You cannot leave the LVTTL UART input floating and expect a predicable result.
> > > > > > You might connect the input to the output as a loopback for testing.
> > > > > >
> > > > > > You can check on the Digital IO screen how the IO is configured.
> > > > > >
> > > > > > Regards
> > > > > > TK
> > > > > >
> > > > > >
> > > > > >
> > > > > > ________________________________
> > > > > > From: himykabibble <jagboy@>
> > > > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > > > Sent: Wednesday, June 13, 2012 11:56 PM
> > > > > > Subject: [DynoMotion] Re: RS232 Not Working?
> > > > > >
> > > > > >
> > > > > > ÃÆ'Æ'Æ'ÃÆ'¢â‚¬Å¡ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > > FWIW - I tried the poll-driven code from the RS232 web page, and got exactly the same result....
> > > > > >
> > > > > > Regards,
> > > > > > Ray L.
> > > > > >
> > > > > > --- In mailto:DynoMotion%40yahoogroups.com, "himykabibble" <jagboy@> wrote:
> > > > > > >
> > > > > > > Tom,
> > > > > > >
> > > > > > > I've got my pendant firmware mostly up, and just tried to use the KFlop RS232 for the first time. I'm using the BufferedRS232 example code, with only the BAUD rate changed to 9600, a while(1) loop added around the existing while loop and RS232_GetChar call, and a printf to print the received character. Trouble is, it spews characters continuously, even though there is nothing even connected to the RS232 data pins! Are you sure this works?
> > > > > > >
> > > > > > > Does the EnableRS232Cmds call set the pin directions, or do I need to do that?
> > > > > > >
> > > > > > > Regards,
> > > > > > > Ray L.
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > // enable RS232 working (if Kanalog, it will be changed to 3)It would be better if you used the newer buffered functions which do the buffering for you, enable this for you, and allow higher baud rates.
> > > >
> > >
> >
>
Group: DynoMotion Message: 5230 From: Tom Kerekes Date: 6/16/2012
Subject: Re: RS232 Not Working?
Hi Ray,
 
That should work.
 
Regards
TK